package top.rainbowecho.common.mq.listener;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import top.rainbowecho.common.mq.config.BlogMqRouteEnum;
import top.rainbowecho.common.mq.config.MqConfiguration;

/**
 * @author rainbow
 * @since 2019/12/6 16:08
 */
@Configuration
public class ListenerConfig {
    private MqConfiguration mqConfiguration;

    @Autowired
    public void setMqConfiguration(MqConfiguration mqConfiguration) {
        this.mqConfiguration = mqConfiguration;
    }

    public String getRouting(BlogMqRouteEnum routeEnum) {
        return mqConfiguration.getRoutes().get(routeEnum).getRouting();
    }

    public String getExchange(BlogMqRouteEnum routeEnum) {
        return mqConfiguration.getRoutes().get(routeEnum).getExchange();
    }
}
